﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;

using Kjs.Report.IService;
using Kjs.Report.EntityFramework;
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Cors;

namespace Kjs.Report.Admin.Controllers
{

    /// <summary>
    /// 
    /// </summary>
    [Produces("application/json")]
    [Authorize("Bearer")]
    [EnableCors("Any")]
    [Route("api/default")]
    public class DefaultController : ApiControllerBase
    {
        private ISysUserService _userService;
        private ILogger<DefaultController> _logger;
        private EFCoreContext dbcontext;
        /// <summary>
        /// 
        /// </summary>
        public DefaultController(ILogger<DefaultController>logger,ISysUserService userService,EFCoreContext eFCoreContext)
        {
            this._userService = userService;
            this._logger = logger;
            this.dbcontext = eFCoreContext;

        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [HttpGet("demo")]
        public string demo()
        {
            this._logger.LogInformation("defaultController Index");
            return "demo";
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [HttpGet("users")]
        public object users()
        {

            var user = dbcontext.SysUsers.ToList();
            return user;
        }
    }
}